import * as API from '../utils/api'

export const LOAD_GROUP_LIST = 'LOAD_GROUP_LIST'
export const UPDATE_GROUP_LIST = 'UPDATE_GROUP_LIST'

export const loadGroupList = function (body) {
    return async function (dispatch)  {
        const list = await API.fetchGroupList(body)
        dispatch(updateGroupList({
            ...list
        }))
    }
}
export const updateGroupList = list => ({type: UPDATE_GROUP_LIST, list})